package ru.amse.stroganova.ui.command;

import ru.amse.stroganova.presentation.GraphPresentation;
import ru.amse.stroganova.presentation.PresentationConverter;
import ru.amse.stroganova.ui.PresentationController;

class ConvertToUndirectedCommand implements Command {

	private final GraphPresentation oldPresentation;
	
	private final GraphPresentation newPresentation;
	
	private final PresentationController controller;
	
	ConvertToUndirectedCommand(GraphPresentation presentation, PresentationController controller) {
		oldPresentation = presentation;
		newPresentation = PresentationConverter.convertToUndirected(presentation);
		this.controller = controller;
	}
	
	public void execute() {
		controller.setNewGraphPresentation(newPresentation);
	}

	public void undo() {
		controller.setNewGraphPresentation(oldPresentation);
	}

}
